<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html lang="zh">
    <head>
        <title>售票审核系统-监控视频审核列表</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link href="css/main.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="js/xmlhandler.js"></script>
        <script type="text/javascript">
            var xmlhttp = new XMLHttpRequest();
            // define the line
            var line = "c58";
        </script>
    </head>
    <body>
        <div id="header">
            <h1><a href="/">欢迎进入售票审核系统</a></h1>
            <h3>监控视频审核列表</h3>
            <button class="btn btn-primary btn-large" type="button" onclick="window.history.back()">返 回</button>
            <hr/>
        </div>
        <div id="main">
            <div id="dateselect">               
                <label for="datepicker">请选择要审核的日期：</label>
                <input id="datepicker" type="date" min="2014-11-21" value="2014-11-21">
                <label for="buslicense">请选择要审核的班车：</label>
                <!-- <input id="buslicense" type="text"> -->
                <select id="buslicense">
                    <!--                    <option>粤BAAAAA</option> 
                                        <option>粤BBBBBB</option>
                                        <option>粤BCCCCC</option>-->
                </select>
                <script type="text/javascript">
//                    var line = 'c58';
                    getBus(line, xmlhttp);
                </script>
                <button id="confirmbtn" class="btn" onclick="comfirmInputData()">确 定</button>
            </div>
            <div id="buslinelist">
                <p></p>
                <table id="listTable">
                    <tr>
                        <th>班 次</th>
                        <th>状 态</th>
                        <th>核实人</th>
                        <th>核 实</th>
                    </tr>
                    <!--                    <tr>
                                            <td>粤BAAAAA2014112101</td>
                                            <td class="greenColor">已审核</td>
                                            <td>犹梦哲</td>
                                            <td><a href="">重审核</a></td>
                                        </tr>
                                        <tr>
                                            <td>粤BBBBBB2014112102</td>
                                            <td class="redColor">未审核</td>
                                            <td></td>
                                            <td><a href="">审核</a></td>
                                        </tr>-->
                </table>
            </div>
        </div>
        <div id="footer">

        </div>
        <script type="text/javascript">
            function comfirmInputData() {
//               window.location.reload();
                var bllEl = document.getElementById('buslinelist');
                var selDate = document.getElementById('datepicker').value;
                var busLicense = document.getElementById('buslicense').value;
                var headText = "<b>日期：</b> " + selDate.toString() + "<b>班车：</b>" + busLicense;
                bllEl.getElementsByTagName('p')[0].innerHTML = headText;

                var datePair = 'date=' + selDate.toString().replace('-', '').replace('-', '');
                var busPair = 'bus=' + busLicense.toLocaleString();
                var linePair = 'line=' + line;
                var getUrl = 'server-script/getLines.php?' + datePair + '&' + busPair + '&' + linePair;
//                console.log(getUrl);
                xmlhttp.onreadystatechange = function () {
                    if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
                        if (xmlhttp.responseText === "NULL") {
//                        alert('Can not get the line info from server.');
                            var tableHead = "<tr><th>班 次</th><th>状 态</th><th>核实人</th><th>核 实</th></tr>";
                            var noData = "<p>服务器上没有所选日期和班车的数据。</p>";
                            document.getElementById('listTable').innerHTML = tableHead + noData;
                        } else {
                            document.getElementById('listTable').innerHTML = xmlhttp.responseText;
                        }
                    }
                };
                xmlhttp.open('GET', getUrl, true);
                xmlhttp.send();
            }
        </script>
    </body>
</html>
